﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;


namespace Reflection
{
    public class DemoAttributes
    {
        [Obsolete("Used method SuperPrintOut")]
        public void PrintOut(String str)
        {
            Console.WriteLine(str);
        }

        [Conditional("DoTrace")]
        public void TraceMessage(string str)
        {
            Console.WriteLine(str);
        }

        public void MyTrace(string message,[CallerFilePath] string fileName = "", [CallerLineNumber] int lineNumber = 0,[CallerMemberName]string callingMember="")
        {
            Console.WriteLine("File:               {0}",fileName);
            Console.WriteLine("Line:               {0}",lineNumber);
            Console.WriteLine("Call form:          {0}",callingMember);
            Console.WriteLine("Message:            {0}",message);
        }
    }

    [System.AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, // Required, positional
        Inherited = false,         //Optional, name
        AllowMultiple = false)]   //Optional, name 
    public sealed class MyAttributeAttribute : System.Attribute
    {
        public string Description;  
        public string Version;  //optional
        public string Reviewer;//optional
        public MyAttributeAttribute(string desc)
        {
            Description = desc;
            
        }
    }

    //Suggested Practices for Custom Attributes
    [System.AttributeUsage(AttributeTargets.Class)]
    public sealed class ReviewCommentAttribute : System.Attribute
    {
        public string Description { get; set; }
        public string VersionNumber { get; set; }
        public string ReviewID { get; set; }

        public ReviewCommentAttribute(string desc, string ver)
        {
            Description = desc;
            VersionNumber = ver;
        }
    }
}
